package com.bbz.core.Youku;

import java.math.BigInteger;

/**
 * 1，设计一个计算器，支持100万位数字的加减乘除法。只是用jdk自带类，不使用第三方类
 */
public class Test_1 {
    public static BigInteger add(BigInteger a, BigInteger b) {
        return a.add(b);
    }

    public static BigInteger subtract(BigInteger a, BigInteger b) {
        return a.subtract(b);
    }

    public static BigInteger multiply(BigInteger a, BigInteger b) {
        return a.multiply(b);
    }

    public static BigInteger divide(BigInteger a, BigInteger b) {
        return a.divide(b);
    }

    public static void main(String[] args) {
        double a = Math.pow(2, 24);
        double b = Math.pow(2, 48);
        BigInteger abi = BigInteger.valueOf((long) a);
        BigInteger bbi = BigInteger.valueOf((long) b);
        System.out.println("a=" + a + "\tb=" + b);
        System.out.println("加法:\t" + add(abi, bbi));
        System.out.println("减法:\t" + subtract(bbi, abi));
        System.out.println("乘法:\t" + multiply(abi, bbi));
        System.out.println("除法:\t" + divide(bbi, abi));
    }

}
